]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
appDisplay: Default to All view when not enough usage data is available
authorFlorian Müllner <fmuellner@gnome.org>
Fri, 30 Aug 2013 18:25:19 +0000 (20:25 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Mon, 2 Sep 2013 19:26:11 +0000 (21:26 +0200)
The frequent view is not useful when it doesn't contain any applications
yet. While the previously added label makes this state appear less like
an error (OMG, my apps are gone!), it doesn't address the issue of
usefulness - default to the more helpful All view in this case.

https://bugzilla.gnome.org/show_bug.cgi?id=694710

js/ui/appDisplay.js

index e19ad13a7c8de85b2c5c97d390e25b2feb48c114..c1e44dc473b759e87a0b3d18b78de82caa6bb693 100644 (file)
@@ -591,9 +591,13 @@ const FrequentView = new Lang.Class({
         this._usage = Shell.AppUsage.get_default();
     },
 
+    hasUsefulData: function() {
+        return this._usage.get_most_used("").length >= MIN_FREQUENT_APPS_COUNT;
+    },
+
     loadApps: function() {
         let mostUsed = this._usage.get_most_used ("");
-        let hasUsefulData = mostUsed.length >= MIN_FREQUENT_APPS_COUNT;
+        let hasUsefulData = this.hasUsefulData();
         this._noFrequentAppsLabel.visible = !hasUsefulData;
         if(!hasUsefulData)
             return;
@@ -724,7 +728,8 @@ const AppDisplay = new Lang.Class({
                     this._showView(viewIndex);
                 }));
         }
-        this._showView(Views.FREQUENT);
+        let frequentUseful = this._views[Views.FREQUENT].view.hasUsefulData();
+        this._showView(frequentUseful ? Views.FREQUENT : Views.ALL);
         this._updateFrequentVisibility();
 
         // We need a dummy actor to catch the keyboard focus if the